<br />
<?php
    if (isset($message) && $message!=''){
     echo "<div style='position:relative; left:260px;'><font color=red>$message</font></div><br />";
    }
?>
<fieldset style="position:relative; left:200px; width:300px;">
    <legend>Thông tin album</legend>
    <form action="<?php echo Utility::getSiteUrl(); ?>/album/updateAlbum" method="post">
    <input type="hidden" name="id" value="<?php echo $album->id ?>" />
    <table>
        <tr>
            <td width="70px">Tên album </td>
            <td><input type="text" maxlength="30" size="30" name="name" value="<?php echo $album->name ?>" />*</td>
        </tr>
        <tr>
            <td>Mô tả</td>
            <td><input type="text" maxlength="100" size="30" name="description" value="<?php echo $album->description ?>" /></td>
        </tr>
        <tr>
            <td>Trạng thái</td>
            <td>
                <select name="status">
                    <option value="0" <?php echo ($album->status == 0)?"selected=selected":""; ?>>Không hiển thị</option>
                    <option value="1" <?php echo ($album->status == 1)?"selected=selected":""; ?>>Hiển thị</option>
                    <option value="2" <?php echo ($album->status == 2)?"selected=selected":""; ?>>Trang chủ</option>
                </select>
            </td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" value="Cập nhất" /></td>
        </tr>
    </table>
    </form>
</fieldset>
<br />
<div align="center">
    <a href="<?php echo Utility::getSiteUrl(); ?>/album">[Quay lại]</a>&nbsp;&nbsp;|
    <a href="<?php echo Utility::getSiteUrl(); ?>/album/additem/<?php echo $album->id; ?>" style="font-weight:bolder; font-size:14px;">[Thêm ảnh vào album]</a>
</div>

<fieldset>
    <legend>Các ảnh trong album</legend>
    <?php
        if ($items == null || count($items) == 0){
            echo "<div style='position:relative; left:260px;'><font color=red>Chưa có hình ảnh nào trong album này</font></div><br />";
        }
    ?>
    <table>
        <tr>
        <?php $i = 0; foreach ($items as $item){ ?>

            <td align="center" style="font-weight:bold;" width="150px">
                <a href='<?php echo Utility::getSiteUrl(); ?>/album/item/<?php echo $album->id; ?>/<?php echo $item->id; ?>'>
                    <?php echo $item->description; ?>
                </a>
                <a onclick="return confirm('Bạn có chắc chắn muốn xóa ảnh này không?');" href='<?php echo Utility::getSiteUrl(); ?>/album/deleteItem/<?php echo $item->id; ?>/<?php echo $album->id; ?>' style="font-weight:100;">[xóa]</a>
                <br />
                <a href='<?php echo Utility::getSiteUrl(); ?>/album/item/<?php echo $album->id; ?>/<?php echo $item->id; ?>'>
                    <img src='<?php echo Utility::websiteRoot(); ?>/public/images/<?php echo (isset($item->thumbnail))?$item->thumbnail:"default.png"; ?>' alt='<?php echo $item->description; ?>' title='<?php echo $item->description; ?>' />
                </a>
                <br /><br />
            </td>

        <?php
                $i++;
                if ($i%6 == 0)
                echo '</tr><tr>';
        } ?>
    </table>
</fieldset>